// 定义一个地图类 需要生成一个地图 
//地图： div  线框   宽  高   在body里面
import  Domain  from "./Domain.js";

var map = new Domain();
export default class Rect {
    //快的left top    背景颜色
    constructor(x, y, color) {
        this.x = x;
        this.y = y;
        this.color = color;
        //调用设置样式的
        this.setStyle();
    }

    setStyle() {
        this.ele = document.createElement("div");
        //宽高50px 绝对路径 left top距离 背景色
        this.ele.style.width = '50px'
        this.ele.style.height = '50px'
        this.ele.style.left = this.x + "px"
        this.ele.style.top = this.y + "px"
        this.ele.style.border = '1px solid'
        this.ele.style.backgroundColor = this.color;
        this.ele.style.position = 'absolute'

        //添加到地图中  map.ele:地图div框
        //往地图的div里面添加方块div
        map.ele.appendChild(this.ele);
    }
}
